#ifndef _SHADOWEFFECT_H_
#define _SHADOWEFFECT_H_

#include <windows.h>
#include <xnamath.h>
#include <d3d11.h>
#include <d3dx11async.h>
#include <fstream>
#include <Effect11/d3dx11effect.h>

class ShadowEffect
{
public:

	void Initialize();
	void Uninit();

	void SetTransformsMatrices(const XMFLOAT4X4 &pWorldMatrix, const XMFLOAT4X4 &pCameraViewMatrix, const XMFLOAT4X4 &pCameraProjectionMatrix, const XMFLOAT4X4 &pLightViewMatrix, const XMFLOAT4X4 &pLightProjectionMatrix, const XMFLOAT4X4 &pLightLargeViewMatrix, const XMFLOAT4X4 &pLightLargeProjectionMatrix);
	
	void Render(int indexCount);
	void SetDepthTexture(ID3D11ShaderResourceView *pTexture);
	void SetDepthLargeTexture(ID3D11ShaderResourceView *pTexture);
protected:
	void InitInputLayout();

	ID3D11Device* mDevice;
	ID3D11DeviceContext* mDeviceContext;
	ID3DX11Effect* mEffect;
	ID3DX11EffectTechnique* mTechnique;
	ID3D11InputLayout* mInputLayout;
	ID3D11ShaderResourceView *mDepthTexture;
	ID3D11ShaderResourceView *mDepthLargeTexture;

	ID3DX11EffectMatrixVariable* mFxMatrixWorld;
	ID3DX11EffectMatrixVariable* mFxCameraViewMatrix;
	ID3DX11EffectMatrixVariable* mFxCameraProjectionMatrix;
	ID3DX11EffectMatrixVariable* mFxDepthViewMatrix;
	ID3DX11EffectMatrixVariable* mFxDepthProjectionMatrix;
	ID3DX11EffectMatrixVariable* mFxDepthLargeViewMatrix;
	ID3DX11EffectMatrixVariable* mFxDepthLargeProjectionMatrix;

	ID3D11SamplerState* mSampleStateClamp;
};

#endif